1. Field of the Invention
The field of the invention is industrial control systems including programmable controllers, and more particularly, a high speed counter module used in conjunction with such industrial control systems.
2. Background Art
Industrial control systems such as those described in
U.S. Pat. Nos. 3,810,118, 3,942,158, 4,165,534 and 4,442,504 are typically connected to industrial equipment such as assembly lines or machine tools, to operate such equipment in accordance with a stored program. The stored program, running on the central processing unit of the system, termed the "controller", includes instructions which, when executed, examine the condition of selected inputs to the system from sensing devices on the controlled equipment and energize or deenergize selected outputs from the system to operate devices on the controlled equipment.
Inputs to the system may be discrete binary signals such as those from switches, which may detect limits of process variables such as motion, temperature, time, or other quantities, or the inputs may be analog measures of the process variables themselves, which are generally then converted to digital binary form for processing. Likewise, the outputs of the system may be either binary outputs as implemented by mechanical or solid state relays, or analog outputs produced by means of a digital to analog converter.
A process variable, such the number of items moving along an assembly line, may be counted by the controller by means of a sensing device which sets and resets a single digital input to the controller for each passing item. The changes in that input may be tallied by means of the program running in the controller.
This approach to counting has two significant drawbacks. The first is that only relatively low count rates may be supported by the controller. Typically, the inputs and outputs of the controller are "scanned" one at a time, the state of each output and input being sequentially written to or read during each scanning cycle. If the counting rate is higher than the scanning rate, some "counts" will be lost.
For many applications, and in particular, those applications where the items to be counted are pulses from a high resolution encoder or the like, the limit imposed by the scanning rate will be unacceptably low. Further, because the actual scan rate varies depending on how many inputs and outputs must be scanned, the maximum count rate must be given an additional margin of reduction to ensure reliable counting under a "worst case" analysis of scan time. Such worst case analysis must take into account possible future expansion of the controls system to include additional inputs and outputs.
The second drawback to the above approach to counting is that the controller is diverted from other control tasks by the need to repeatedly examine the particular input being counted and to execute a portion of its program to count that input signal.
Accordingly, it is known to use a separate binary counter module communicating with the controller to independently count such process variables. The binary count produced by the counter may then be read by the controller on a less frequent basis to determine if a given count has been reached.
An improvement to the use of separate counter module is the combining of a counter with one or more comparators to constantly evaluate the count against threshold values and to produce a binary signal indicating whether or not the count has exceeded the threshold value. This use of the comparator frees the controller from repeatedly loading the multi-bit count and comparing it to a threshold value in its program. Rather, the comparator allows the controller to examine only the single bit of the comparator's output representing the state of the count with respect to the threshold value.
With more complex systems it may become necessary to evaluate the count of a counter against a number of thresholds. For example, it may be desirable that the program running in the controller execute a first task when the count reaches a first value and execute a second task only if the count reaches a second value and so forth. This may be accomplished by wiring several comparators to each counter so that different thresholds may be established.
Ultimately, the disadvantage of implementing the counting function in "hardware", (that is discrete circuity), rather than through the "software" of the controller, is that the counting function is much less flexible. The number of threshold values is fixed by the counter circuitry and cannot be increased as the application may demand. For this reason it is the practice to provide each counter with a number of extra comparators for producing additional thresholds. Counters having as many as four different threshold values are commercially available, but even this number may be too little for some applications. Further, the extra cost of the unused threshold circuitry may be significant in cases where only one threshold value is needed.